package cm.aoplog.services;

import cm.aoplog.dto.OperateLogCreateReqDTO;
import cm.aoplog.entity.LogRecordDO;
import cm.aoplog.entity.OperateLog;
import cm.aoplog.mapper.OperateLogMapper;
import cn.hutool.core.bean.BeanUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;

import javax.annotation.Resource;

/**
 * 操作日志 Framework Service 实现类
 * author:yxh
 */
@RequiredArgsConstructor
public class OperateLogFrameworkServiceImpl implements OperateLogFrameworkService {

    @Resource
    private OperateLogMapper operateLogMapper;

    @Override
    @Async
    public void createOperateLog(OperateLog operateLog) {
//        OperateLogCreateReqDTO reqDTO = BeanUtil.copyProperties(operateLog, OperateLogCreateReqDTO.class);
        LogRecordDO logRecordDO = BeanUtil.copyProperties(operateLog,LogRecordDO.class);
        operateLogMapper.insert(logRecordDO);
    }

}
